<?php
class Findpass_m extends CI_Model{
    public function __construct() {
        parent::__construct();
        $this->load->database();
    }
    public function find_email_admin($id_ad)
    {
        $this->db->select('*');
        $this->db->from('admin');
        $this->db->where('id_ad',$id_ad);
        $this->db->limit(1);
        $query_email_ad=$this->db->get();
        if($query_email_ad->num_rows()==1)
        {
            return $query_email_ad->result();
        }
        else 
        {
            return FALSE;
        }
    }
    public function find_email_manager($id_mg)
    {
        $this->db->select('*');
        $this->db->from('manager');
        $this->db->where('id_mg',$id_mg);
        $this->db->limit(1);
        $query_email_mg=$this->db->get();
        if($query_email_mg->num_rows()==1)
        {
            return $query_email_mg->result();
        }
        else 
        {
            return FALSE;
        }
    }
    public function find_email_examiner($id_ex)
    {
        $this->db->select('*');
        $this->db->from('examiner');
        $this->db->where('id_ex',$id_ex);
        $this->db->limit(1);
        $query_email_ex=$this->db->get();
        if($query_email_ex->num_rows()==1)
        {
            return $query_email_ex->result();
        }
        else 
        {
            return FALSE;
        }
    }
     public function find_email_maker($id_mk)
    {
        $this->db->select('*');
        $this->db->from('maker');
        $this->db->where('id_mk',$id_mk);
        $this->db->limit(1);
        $query_email_mk=$this->db->get();
        if($query_email_mk->num_rows()==1)
        {
            return $query_email_mk->result();
        }
        else 
        {
            return FALSE;
        }
    }
    public function find_email($id)
    {
        $sql="SELECT email,password
            FROM admin AS a,manager AS b,examiner AS c WHERE id_ad='$id' OR id_mg='$id' OR id_ex='$id'";
        $query = $this->db->query($sql);
        return $query->result();
    }
}